package com.niit.service;

import com.niit.model.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *  Feign注解式开发，将接口与服务提供方的对应，然后提供给Controller
 *  value值对应服务提供方： eureka.instance.instance-id
 */
@FeignClient(value = "ADMIN-PROVIDER",fallbackFactory = AdminFallbackFactory.class)
public interface AdminService {

    @GetMapping("/admin")
    List<Admin> adminlist();
    @GetMapping("/student")
    List<Student> studentlist();
    @GetMapping("/teacher")
    List<Teacher> teacherlist( );
    @GetMapping("/class")
    List<Classes> classlist( );
    @GetMapping("/question")
    List<Question> questionslist( );
    @GetMapping("/exampaper")
    List<ExamPaper> exampaperslist( );

    @GetMapping("/admin/{id}")
    Admin getadminById(@PathVariable("id") Long id);
    @GetMapping("/student/{id}")
    Student getstudentById(@PathVariable("id") Long id);
    @GetMapping("/teacher/{id}")
    Teacher getteacherById(@PathVariable("id") Long id);
    @GetMapping("/class/{id}")
    Classes getclassById(@PathVariable("id") Long id);
    @GetMapping("/question/{id}")
    Question getquestionById(@PathVariable("id") Long id);
    @GetMapping("/exampaper/{id}")
    ExamPaper getExamPaperById(@PathVariable("id") Long id);

    @PostMapping("/admin")
    String add(@RequestBody Admin admin);
    @PostMapping("/student")
    String add(@RequestBody Student student);
    @PostMapping("/teacher")
    String add(@RequestBody Teacher teacher);
    @PostMapping("/class")
    String add(@RequestBody Classes classes);
    @PostMapping("/question")
    String add(@RequestBody Question question);
    @PostMapping("/exampaper")
    String add(@RequestBody ExamPaper examPaper);

    @PutMapping("/admin")
     String updateadmin(@RequestBody Long id);
    @PutMapping("/teacher")
     String updateteacher(@RequestBody Long id);
    @PutMapping("/student")
    String updatestudent(@RequestBody Long id);
    @PutMapping("/class")
     String updateclass(@RequestBody Long id );
    @PutMapping("/question")
    String updatequestion(@RequestBody  Long id) ;
    @PutMapping("/exampaper")
    String updateexampaper(@RequestBody   Long id) ;
    @PutMapping("/status")
    String updatestatus(@RequestBody  Long id);


    @DeleteMapping("/admin/{id}")
    String deleteAdminById(@PathVariable("id") Long id);
    @DeleteMapping("/student/{id}")
    String deleteStudentById(@PathVariable("id") Long id);
    @DeleteMapping("/teacher/{id}")
    String deleteTeacherById(@PathVariable("id") Long id);
    @DeleteMapping("/class/{id}")
    String deleteClassById(@PathVariable("id") Long id);
    @DeleteMapping("/question/{id}")
    String deleteQuestionById(@PathVariable("id") Long id);
    @DeleteMapping("/exampaper/{id}")
    String deleteExamPaperById(@PathVariable("id") Long id);
}
